package com.szit.deviceserver.controller;

import com.szit.deviceserver.server.DeviceUserServer;
import com.szit.util.Result;
import com.szit.util.vo.AdminUserInfo;
import com.szit.util.vo.DeviceUserInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author wyler
 * @date 2020-10-15
 */
@Slf4j
@RestController
public class DeviceUserController {

    @Autowired
    private DeviceUserServer deviceUserServer;

    @PostMapping("insertDeviceUser")
    public Result insertDeviceUser(@RequestBody DeviceUserInfo deviceUserInfo){
        log.info("device-server: insertDeviceUser");
        return deviceUserServer.insertDeviceUser(deviceUserInfo);
    }

    @PostMapping("deleteDeviceUser")
    @ResponseBody
    public Result deleteDeviceUser(@RequestBody DeviceUserInfo deviceUserInfo){
        log.info("device-server: deleteDeviceUser");
        return deviceUserServer.deleteDeviceUser(deviceUserInfo);
    }

    @PostMapping("updateDeviceUser")
    @ResponseBody
    public Result updateDeviceUser(@RequestBody DeviceUserInfo deviceUserInfo){
        log.info("device-server: updateDeviceUser");
        return deviceUserServer.updateDeviceUser(deviceUserInfo);
    }

    @PostMapping("selectAllDeviceUser")
    @ResponseBody
    public Result selectAllDeviceUser(Integer pageNum, Integer pageSize){
        log.info("device-server: selectAllDeviceUser");
        return deviceUserServer.selectAllDeviceUser(pageNum,pageSize);
    }
}
